<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div id="">
			省份：<select id="sheng" name="" onchange="change1()">
				<option value="-1">请选择省份</option>
			</select>
			城市:<select id="city" name="" onchange="change2()">
				<option value="-1">请选择城市</option>
			</select><br>
			 你选择的是：<label id="text"></label>
		</div>
	</body>
	<script type="text/javascript">
		var sheng2=['北京市','上海市','福建省','广东省','浙江省']
		var citys=[
			['海淀区',' 朝阳区'],
			['浦东','浦西'],
			['福州市','厦门市','龙岩市'],
			['广州市','深圳市','东莞市'],
			['杭州市','温州市'],
			['南京市','苏州市']
		]
		function change1(){
			var sheng1=document.getElementById('sheng')
			var city1=document.getElementById('city')
			city1.innerHTML='<option value="-1">请选择省份</option>'
			var city2=citys[sheng1.value]
			for(var i=0;i<city2.length;i++){
				city1.innerHTML+='<option value="'+i+'">'+city2[i]+'</option>'
			}
		}
		function change2(){
			var label1=document.getElementById('text')
			var sheng1=document.getElementById('sheng')
			var city1=document.getElementById('city')
			var shengname=sheng2[sheng1.value]
			var cityname=citys[sheng1.value][city1.value]
			label1.innerText=shengname+cityname
	     }
		onload=function(){
			var sheng1=document.getElementById('sheng')
			for(var i=0;i<sheng2.length;i++){
				sheng1.innerHTML+='<option value="'+i+'">'+sheng2[i]+'</option>'
			}
		}
	</script>
</html>
